fix(dns): honor sreportal.io/groups annotation for auto sources#306
Merged
Conversation
The sreportal.io/groups annotation on external-dns source resources was ignored: groups appeared neither in the auto DNSRecords nor in the UI. Two compounding causes, both fixed: (A) adapter.EnrichEndpointLabels — the bridge that folds sreportal annotations from the resource onto the endpoint labels — was dead code, never called. The source cycle now calls it (on the freshly-resolved, unshared endpoint) so the annotations reach ep.Labels. (B) the v1alpha2 spec.entries projection couldn't carry multiple groups: endpointsToEntries only read the singular sreportal.io/group, and DNSRecordEntry had no multi-group field. Add DNSRecordEntry.Groups ([]string); endpointsToEntries parses sreportal.io/groups (CSV) into it, and MaterialiseEntriesHandler re-injects it as the sreportal.io/groups status label so the read-side GroupMappingStrategy.Resolve (priority 1) projects the FQDN into all its groups in the UI. Extract domaindns.SplitGroups, shared by Resolve and endpointsToEntries so the controller-side parse exactly matches the read side. CRD/deepcopy/ helm/docs regenerated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…to path) Review: the comment over-promised that ignore logic is honored on the auto path; only sreportal.io/groups is actually consumed downstream. Reword. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
sreportal.io/groupsannotation on external-dns source resources was ignored: the groups showed up neither in the auto DNSRecords nor in the UI.Two compounding causes, both fixed:
(A)
adapter.EnrichEndpointLabelswas dead code. The bridge that folds sreportal annotations from the resource onto the endpoint labels was never called. The source cycle now calls it on the freshly-resolved (unshared) endpoint, so the annotations reachep.Labels.(B) the v1alpha2
spec.entriesprojection couldn't carry multiple groups.endpointsToEntriesonly read the singularsreportal.io/groupandDNSRecordEntryhad no multi-group field. AddDNSRecordEntry.Groups []string;endpointsToEntriesparsessreportal.io/groups(CSV) into it, andMaterialiseEntriesHandlerre-injects it as thesreportal.io/groupsstatus label so the read-sideGroupMappingStrategy.Resolve(priority 1) projects the FQDN into all its groups.Extract
domaindns.SplitGroups, shared byResolveandendpointsToEntriesso the controller-side parse exactly matches the read side. CRD / deepcopy / helm / docs regenerated.Notes
sreportal.io/groupsstatus label is intentionally included in the endpoints hash (a groups change should refresh the projection); the join is deterministic, so no reconcile churn.DNSRecordEntryround-trips whole via the spec annotation, soGroupsis preserved automatically.ignore/portal/componentannotations are folded onto source labels by the shared helper but are inert on the auto DNS path (dropped atspec.entries); onlygroupsis carried through.Test plan
SplitGroups(csv/empty/whitespace)sreportal.io/groupsonto the endpoint (A)endpointsToEntriesparses multi-group intoentry.Groups(B)MaterialiseEntriesHandlerre-injects thesreportal.io/groupsstatus label (B)go test -race,golangci-lintclean; CRD/helm/doc regenerated🤖 Generated with Claude Code